<!DOCTYPE html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">



  
  
    
    
  <script src="/lib/pace/pace.min.js?v=1.0.2"></script>
  <link href="/lib/pace/pace-theme-minimal.min.css?v=1.0.2" rel="stylesheet">




  
  
  <link rel="stylesheet" media="all" href="/lib/Han/dist/han.min.css?v=3.3">




<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Git,Blog,">





  <link rel="alternate" href="/atom.xml" title="琢玉阁" type="application/atom+xml">






<meta name="description" content="Git及GitHub  Git是目前世界上最先进的分布式版本控制系统   GitHub是一个面向开源及私有软件项目的托管平台，因为只支持git 作为唯一的版本库格式进行托管，故名gitHub。   在最近一次更新中，GitHub免费用户现在可以创建无限量的私人存储库。GitHub免费用户创建的私人存储库最多最多可以有3名协作者  Git的工作原理 WorkSpace：工作区 Index/Stage">
<meta name="keywords" content="Git,Blog">
<meta property="og:type" content="article">
<meta property="og:title" content="个人免费博客搭建（Git篇）">
<meta property="og:url" content="https://littlereed.gitee.io/category/个人免费博客搭建（Git篇）/index.html">
<meta property="og:site_name" content="琢玉阁">
<meta property="og:description" content="Git及GitHub  Git是目前世界上最先进的分布式版本控制系统   GitHub是一个面向开源及私有软件项目的托管平台，因为只支持git 作为唯一的版本库格式进行托管，故名gitHub。   在最近一次更新中，GitHub免费用户现在可以创建无限量的私人存储库。GitHub免费用户创建的私人存储库最多最多可以有3名协作者  Git的工作原理 WorkSpace：工作区 Index/Stage">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c5492274be00.jpg">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c549259f2339.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c54934b167ba.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c549365f36db.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c54937c6e73f.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c54938aae1c0.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c5493e984c6d.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c54940abed61.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c54941f2849b.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c54942e9d794.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c5495242ae8c.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c54950f0b4a1.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c54953749c89.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c54944360455.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c549553668e7.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c54955f907ce.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c5495969f162.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c5495a2e546a.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c5496081392f.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c54961f01a08.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c54963395838.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c5496447cc30.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c54965f3f646.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c549686e19cd.png">
<meta property="og:image" content="https://i.loli.net/2019/02/02/5c5496969b398.png">
<meta property="og:updated_time" content="2019-02-03T16:22:23.051Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="个人免费博客搭建（Git篇）">
<meta name="twitter:description" content="Git及GitHub  Git是目前世界上最先进的分布式版本控制系统   GitHub是一个面向开源及私有软件项目的托管平台，因为只支持git 作为唯一的版本库格式进行托管，故名gitHub。   在最近一次更新中，GitHub免费用户现在可以创建无限量的私人存储库。GitHub免费用户创建的私人存储库最多最多可以有3名协作者  Git的工作原理 WorkSpace：工作区 Index/Stage">
<meta name="twitter:image" content="https://i.loli.net/2019/02/02/5c5492274be00.jpg">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    version: '5.1.4',
    sidebar: {"position":"right","display":"hide","offset":12,"b2t":false,"scrollpercent":false,"onmobile":"Muse"},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://littlereed.gitee.io/category/个人免费博客搭建（Git篇）/">





  <title>个人免费博客搭建（Git篇） | 琢玉阁</title>
  




<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  ga('create', 'c995c8302f5df79e516f8479fdda661d', 'auto');
  ga('send', 'pageview');
</script>





</head>

<body itemscope="" itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-right page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope="" itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">琢玉阁</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-essay">
          <a href="/essay/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            essay
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br>
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off" placeholder="搜索..." spellcheck="false" type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://littlereed.gitee.io/category/个人免费博客搭建（Git篇）/">

    <span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person">
      <meta itemprop="name" content="LuckyStrike">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="琢玉阁">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">个人免费博客搭建（Git篇）</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2019-02-03T11:32:08+08:00">
                2019-02-03
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope="" itemtype="http://schema.org/Thing">
                  <a href="/categories/技术/" itemprop="url" rel="index">
                    <span itemprop="name">技术</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/category/个人免费博客搭建（Git篇）/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count valine-comment-count" data-xid="/category/个人免费博客搭建（Git篇）/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          
             <span id="/category/个人免费博客搭建（Git篇）/" class="leancloud_visitors" data-flag-title="个人免费博客搭建（Git篇）">
               <span class="post-meta-divider">|</span>
               <span class="post-meta-item-icon">
                 <i class="fa fa-eye"></i>
               </span>
               
                 <span class="post-meta-item-text">热度&#58;</span>
               
                 <span class="leancloud-visitors-count"></span>
                 <span>℃</span>
             </span>
          

          

          
            <div class="post-wordcount">
              
                
                <span class="post-meta-item-icon">
                  <i class="fa fa-file-word-o"></i>
                </span>
                
                  <span class="post-meta-item-text">字数统计&#58;</span>
                
                <span title="字数统计">
                  1.2k
                </span>
              

              
                <span class="post-meta-divider">|</span>
              

              
                <span class="post-meta-item-icon">
                  <i class="fa fa-clock-o"></i>
                </span>
                
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                
                <span title="阅读时长">
                  4
                </span>
              
            </div>
          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body han-init-context" itemprop="articleBody">

      
      

      
        <h1 id="Git及GitHub"><a href="#Git及GitHub" class="headerlink" title="Git及GitHub"></a>Git及GitHub</h1><p><img src="https://i.loli.net/2019/02/02/5c5492274be00.jpg" alt="5c5492274be00"></p>
<blockquote>
<p>Git是目前世界上最先进的分布式版本控制系统</p>
</blockquote>
<blockquote>
<p>GitHub是一个面向开源及私有软件项目的托管平台，因为只支持git 作为唯一的版本库格式进行托管，故名gitHub。</p>
</blockquote>
<blockquote>
<p>在最近一次更新中，GitHub免费用户现在可以创建无限量的私人存储库。GitHub免费用户创建的私人存储库最多最多可以有3名协作者</p>
</blockquote>
<h2 id="Git的工作原理"><a href="#Git的工作原理" class="headerlink" title="Git的工作原理"></a>Git的工作原理</h2><p><img src="https://i.loli.net/2019/02/02/5c549259f2339.png" alt=""></p>
<p>WorkSpace：工作区</p>
<p>Index/Stage：暂存区</p>
<p>Repository：仓库区（本地仓库）</p>
<p>Remote：远程仓库</p>
<hr>
<h1 id="注册账户及创建仓库"><a href="#注册账户及创建仓库" class="headerlink" title="注册账户及创建仓库"></a>注册账户及创建仓库</h1><ul>
<li>进入GitHub的官方网站 <a href="https://github.com/" target="_blank" rel="noopener">https://github.com/</a>，在官网上可以注册属于自己的GitHub账号</li>
</ul>
<p><img src="https://i.loli.net/2019/02/02/5c54934b167ba.png" alt=""><img src="https://i.loli.net/2019/02/02/5c549365f36db.png" alt=""></p>
<ul>
<li><p>简单操作之后，通过邮箱验证，即可正常使用GitHub</p>
</li>
<li><p>登录自己的GitHub账号之后，点击网页右上角的加号，选择<u>New repository</u>来创建自己的库</p>
</li>
</ul>
<p><img src="https://i.loli.net/2019/02/02/5c54937c6e73f.png" alt=""></p>
<p><img src="https://i.loli.net/2019/02/02/5c54938aae1c0.png" alt=""></p>
<ul>
<li>到此，你已经有了自己的GitHub账号并创建了代码库,为了要让本地的代码库与GitHub上的代码库同步，还需要Git这个软件的帮助</li>
</ul>
<hr>
<h1 id="Git的下载及安装"><a href="#Git的下载及安装" class="headerlink" title="Git的下载及安装"></a>Git的下载及安装</h1><ul>
<li><p>进入Git官网<a href="https://www.git-scm.com/download/" target="_blank" rel="noopener">https://www.git-scm.com/download/</a>，根据自己需要选择适合自己电脑相应的版本，这里我们选择的是Windows版本</p>
<p><img src="https://i.loli.net/2019/02/02/5c5493e984c6d.png" alt=""></p>
<p>安装过程不再赘述，默认安装即可</p>
</li>
<li><p>安装完成后，打开shell，输入命令<code>git version</code>得到如图版本号，即可说明git安装成功</p>
<p><img src="https://i.loli.net/2019/02/02/5c54940abed61.png" alt="5c54940abed61"></p>
</li>
<li><p>安装成功后还需要最后一步设置，打开Git bash在命令行输入如下命令</p>
</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$git config --global user.name &quot;$&#123;user.name&#125;&quot;</span><br><span class="line">$git config --global user.email &quot;$&#123;user.email&#125;&quot;</span><br></pre></td></tr></table></figure>
<ul>
<li><code>${user.name}</code>及<code>${user.email}</code>使用刚注册的账号的用户名和邮箱</li>
</ul>
<hr>
<h1 id="本地Git仓库与GitHub仓库的连接"><a href="#本地Git仓库与GitHub仓库的连接" class="headerlink" title="本地Git仓库与GitHub仓库的连接"></a>本地Git仓库与GitHub仓库的连接</h1><ul>
<li>创建SSH Key。打开Git Bash输入如下命令</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh-keygen -t rsa -C &quot;$&#123;user.email&#125;&quot;</span><br></pre></td></tr></table></figure>
<ul>
<li><p>在用户主目录下，有.ssh目录，在这个目录里面，有id_rsa和id_rsa.pub两个文件。id_rsa是  私钥，不能泄露，id_rsapub是公钥，可以放心告诉别人。</p>
</li>
<li><p>登录GitHub，打开setting中的SSH Keys页面，然后点击Add SSH Key，填上任意title，在Key文本框里粘贴id_rsa.pub文件的内容</p>
<p><img src="https://i.loli.net/2019/02/02/5c54941f2849b.png" alt=""></p>
<p><img src="https://i.loli.net/2019/02/02/5c54942e9d794.png" alt="5c54942e9d794"></p>
<p>最后点击Add Key，就可以看到已经添加的Key</p>
<hr>
</li>
</ul>
<h1 id="Git的相关操作"><a href="#Git的相关操作" class="headerlink" title="Git的相关操作"></a>Git的相关操作</h1><h2 id="创建版本库（repository）"><a href="#创建版本库（repository）" class="headerlink" title="创建版本库（repository）"></a>创建版本库（repository）</h2><p>如在E:\WorkSpace\GitSpace目录下新建一个testgit版本库</p>
<p><img src="https://i.loli.net/2019/02/02/5c5495242ae8c.png" alt=""></p>
<ul>
<li><code>pwd</code>命令是用于显示当前的目录</li>
</ul>
<blockquote>
<p>通过命令<code>git init</code>把这个目录变成git可以管理的仓库</p>
</blockquote>
<p><img src="https://i.loli.net/2019/02/02/5c54950f0b4a1.png" alt=""></p>
<ul>
<li>这个时候，testgit目录下会多了一个.git的目录，这个目录是git用来跟踪管理版本的，不得随意更改文件，会导致git仓库被破坏</li>
</ul>
<h2 id="文件的提交及修改"><a href="#文件的提交及修改" class="headerlink" title="文件的提交及修改"></a>文件的提交及修改</h2><blockquote>
<p>将文件添加至暂存区 <code>git add “文件名”</code></p>
</blockquote>
<p><img src="https://i.loli.net/2019/02/02/5c54953749c89.png" alt="5c54953749c89"></p>
<ul>
<li>没有任何提示，说明已经添加成功</li>
</ul>
<blockquote>
<p>将文件提交到仓库 <code>git commit -m &quot;提交的注释&quot;</code></p>
</blockquote>
<p><img src="https://i.loli.net/2019/02/02/5c54944360455.png" alt=""></p>
<blockquote>
<p>查看暂存区是否还有文件未提交 <code>git status</code></p>
</blockquote>
<p> <img src="https://i.loli.net/2019/02/02/5c549553668e7.png" alt=""></p>
<ul>
<li><p>说明没有文件未提交</p>
<p><img src="https://i.loli.net/2019/02/02/5c54955f907ce.png" alt=""></p>
</li>
<li><p>说明文件已被修改，且未被提交</p>
<ul>
<li>注：所有版本控制系统，只能跟踪文本文件的改动，如txt文件，网页，程序代码等，但是图片，视频这些二进制文件没法跟踪文件变化。</li>
</ul>
</li>
</ul>
<blockquote>
<p>查看文件修改内容 <code>git diff &quot;文件名&quot;</code></p>
</blockquote>
<p> <img src="https://i.loli.net/2019/02/02/5c5495969f162.png" alt=""></p>
<ul>
<li><p>说明文件内容从一行111111改成两行，添加了一行222222内容 </p>
<p><img src="https://i.loli.net/2019/02/02/5c5495a2e546a.png" alt="5c5495a2e546a"></p>
</li>
</ul>
<p>   再次提交，方法同上</p>
<h2 id="版本回退"><a href="#版本回退" class="headerlink" title="版本回退"></a>版本回退</h2><p>上面已经对文件修改一次，现在继续修改，再增加一行333333内容</p>
<blockquote>
<p>查看修改历史记录 <code>git log</code> / <code>git log --pretty=oneline</code></p>
</blockquote>
<p> <img src="https://i.loli.net/2019/02/02/5c5496081392f.png" alt=""></p>
<p> <img src="https://i.loli.net/2019/02/02/5c54961f01a08.png" alt=""></p>
<ul>
<li>嫌第一种显示信息太多的可以选择第二种</li>
</ul>
<blockquote>
<p>回退上一个版本 <code>git reset --hard HEAD^</code></p>
</blockquote>
<p> <img src="https://i.loli.net/2019/02/02/5c54963395838.png" alt=""></p>
<ul>
<li>回退到上上个版本只需将“HEAD^”改成“HEAD^^”、以此类推</li>
</ul>
<blockquote>
<blockquote>
<p>回退到前多个版本 <code>git reset --hard HEAD-100</code></p>
</blockquote>
</blockquote>
<ul>
<li>这里为回退到前100个版本</li>
</ul>
<blockquote>
<blockquote>
<p>回退到最新版本，通过版本号回退 <code>git reset --hard &quot;版本号&quot;</code></p>
</blockquote>
</blockquote>
<ul>
<li><p>查看版本号 <code>git reflog</code></p>
<p><img src="https://i.loli.net/2019/02/02/5c5496447cc30.png" alt=""></p>
<p><img src="https://i.loli.net/2019/02/02/5c54965f3f646.png" alt=""> </p>
</li>
</ul>
<h2 id="撤销修改和删除文件"><a href="#撤销修改和删除文件" class="headerlink" title="撤销修改和删除文件"></a>撤销修改和删除文件</h2><p>在readme.txt再添加一行内容444444，接着新建一个文件名为test.txt，内容为test<br>在readme.txt再添加一行内容555555，未提交之前发现内容有误</p>
<blockquote>
<p>撤销修改</p>
</blockquote>
<p> 撤销修改有多种方法</p>
<ul>
<li>知道要修改内容，直接手动修改，再add到暂存区，最后commit至仓库</li>
<li>使用命令<code>git reset --hard HEAD^</code>直接恢复到上一个版本</li>
<li><p>使用命令<code>git checkout  -- &quot;文件名&quot;</code>撤销工作区修改</p>
<p><img src="https://i.loli.net/2019/02/02/5c549686e19cd.png" alt=""></p>
<ul>
<li>注1：该命令只能撤销添加至暂存区后的状态</li>
<li>注2：“–”很重要，没有的话撤销命令就变成创建分支命令了  </li>
</ul>
</li>
</ul>
<blockquote>
<p>删除文件 <code>rm &quot;文件名&quot;</code></p>
</blockquote>
<p> <img src="https://i.loli.net/2019/02/02/5c5496969b398.png" alt=""></p>
<h2 id="本地库推送到远程及从远程库克隆到本地库"><a href="#本地库推送到远程及从远程库克隆到本地库" class="headerlink" title="本地库推送到远程及从远程库克隆到本地库"></a>本地库推送到远程及从远程库克隆到本地库</h2><blockquote>
<p>推送 <code>git push origin master</code></p>
</blockquote>
<blockquote>
<p>克隆</p>
</blockquote>

      
    </div>
    
    
    

    <div>
      
        
<div class="my_post_copyright">
  <script src="//cdn.bootcss.com/clipboard.js/1.5.10/clipboard.min.js"></script>
  
  <!-- JS库 sweetalert 可修改路径 -->
  <script src="https://cdn.bootcss.com/jquery/2.0.0/jquery.min.js"></script>
  <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
  <p><span>本文标题:</span>个人免费博客搭建（Git篇）</p>
  <p><span>文章作者:</span><a href="theme.author" title="访问 LuckyStrike 的个人博客">LuckyStrike</a></p>
  <p><span>发布时间:</span>2019年02月03日 - 11:32</p>
  <p><span>最后更新:</span>2019年02月04日 - 00:22</p>
  <p><span>原始链接:</span>https://littlereed.gitee.io/category/个人免费博客搭建（Git篇）/
    <span class="copy-path" title="点击复制文章链接"><i class="fa fa-clipboard" data-clipboard-text="https://littlereed.gitee.io/category/个人免费博客搭建（Git篇）/" aria-label="复制成功！"></i></span>
  </p>
  <p><span>许可协议:</span><i class="fa fa-creative-commons"></i> <a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">署名-非商业性使用-禁止演绎 4.0 国际</a> 转载请保留原文链接及作者。</p>  
</div>
<script> 
    var clipboard = new Clipboard('.fa-clipboard');
      $(".fa-clipboard").click(function(){
      clipboard.on('success', function(){
        swal({   
          title: "",   
          text: '复制成功',
          icon: "success", 
          showConfirmButton: true
          });
        });
    });  
</script>


      
    </div>

    

    

    

    <div>
      
        <div>
	
		<div style="text-align: center; color: #ccc; font-size: 14px;">---------------本文结束<i class="fa fa-paw"></i>感谢阅读---------------<div> 
	
</div>
      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Git/" rel="tag"> 
              <i class="fa fa-tag"></i> Git
            </a>
          
            <a href="/tags/Blog/" rel="tag"> 
              <i class="fa fa-tag"></i> Blog
            </a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/category/个人免费博客搭建（实操篇）/" rel="prev" title="个人免费博客搭建（实操篇）">
                个人免费博客搭建（实操篇） <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </div></div></article>



    <div class="post-spread">
      
    </div>
  </div>


  <span id="/" class="leancloud_visitors" data-flag-title="">
  </span>



          </div>
          


          

  
    <div class="comments" id="comments">
    </div>
  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
      <div id="sidebar-dimmer"></div>
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope="" itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/images/avatar.jpg" alt="LuckyStrike">
            
              <p class="site-author-name" itemprop="name">LuckyStrike</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives">
              
                  <span class="site-state-item-count">3</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">2</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">3</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          
            <div class="feed-link motion-element">
              <a href="/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/LittleReed" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i>GitHub</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://weibo.com/5847572564" target="_blank" title="Weibo">
                      
                        <i class="fa fa-fw fa-weibo"></i>Weibo</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://www.jianshu.com/u/54061bb62749" target="_blank" title="简书">
                      
                        <i class="fa fa-fw fa-heartbeat"></i>简书</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://me.csdn.net/LuckyStrike_" target="_blank" title="csdn">
                      
                        <i class="fa fa-fw fa-crosshairs"></i>csdn</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://juejin.im/user/5c550f89f265da2db305289d" target="_blank" title="掘金">
                      
                        <i class="fa fa-fw fa-spinner"></i>掘金</a>
                  </span>
                
            </div>
          

          
          

          
          
            <div class="links-of-blogroll motion-element links-of-blogroll-block">
              <div class="links-of-blogroll-title">
                <i class="fa  fa-fw fa-link"></i>
                Links
              </div>
              <ul class="links-of-blogroll-list">
                
                  <li class="links-of-blogroll-item">
                    <a href="https://mail.qq.com/" title="QQEmail" target="_blank">QQEmail</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.nocmd.com/" title="NOCMD" target="_blank">NOCMD</a>
                  </li>
                
              </ul>
            </div>
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#Git及GitHub"><span class="nav-number">1.</span> <span class="nav-text">Git及GitHub</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#Git的工作原理"><span class="nav-number">1.1.</span> <span class="nav-text">Git的工作原理</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#注册账户及创建仓库"><span class="nav-number">2.</span> <span class="nav-text">注册账户及创建仓库</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#Git的下载及安装"><span class="nav-number">3.</span> <span class="nav-text">Git的下载及安装</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#本地Git仓库与GitHub仓库的连接"><span class="nav-number">4.</span> <span class="nav-text">本地Git仓库与GitHub仓库的连接</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#Git的相关操作"><span class="nav-number">5.</span> <span class="nav-text">Git的相关操作</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#创建版本库（repository）"><span class="nav-number">5.1.</span> <span class="nav-text">创建版本库（repository）</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#文件的提交及修改"><span class="nav-number">5.2.</span> <span class="nav-text">文件的提交及修改</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#版本回退"><span class="nav-number">5.3.</span> <span class="nav-text">版本回退</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#撤销修改和删除文件"><span class="nav-number">5.4.</span> <span class="nav-text">撤销修改和删除文件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#本地库推送到远程及从远程库克隆到本地库"><span class="nav-number">5.5.</span> <span class="nav-text">本地库推送到远程及从远程库克隆到本地库</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>


<div class="copyright">
  &copy; 
  
  <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">
    LuckyStrike
  </span>

  
</div>


<div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



<div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Mist</a> v5.1.4</div>




<div>

 <script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script> <span id="busuanzi_container_site_pv">总访问量<span id="busuanzi_value_site_pv"></span>次</span> <span class="post-meta-divider">|</span> <span id="busuanzi_container_site_uv">总访客<span id="busuanzi_value_site_uv"></span>人</span> <span class="post-meta-divider">|</span> 


<class="theme-info">
  <div class="powered-by"></div>
  <span class="post-count">博客全站共1.9k字</span>

</class="theme-info"></div>

        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  










  <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
  <script src="//unpkg.com/valine/dist/Valine.min.js"></script>
  
  <script type="text/javascript">
    var GUEST = ['nick','mail','link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item=>{
      return GUEST.indexOf(item)>-1;
    });
    new Valine({
        el: '#comments' ,
        verify: false,
        notify: false,
        appId: 'Q2SDGpDhiqh4oSYAFOKW38hz-gzGzoHsz',
        appKey: 'UhzvoTR9Qx7zQhTbjADd6KGB',
        placeholder: '',
        avatar:'wavatar',
        guest_info:guest,
        pageSize:'10' || 10,
    });
  </script>



  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url);
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





  

  
  <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.4.js"></script>
  <script>AV.initialize("Lz0dkk9hFy78L9WcaBYlgFIo-gzGzoHsz", "URy0aMD4uIIo80mvOtaCxUrO");</script>
  <script>
    function showTime(Counter) {
      var query = new AV.Query(Counter);
      var entries = [];
      var $visitors = $(".leancloud_visitors");

      $visitors.each(function () {
        entries.push( $(this).attr("id").trim() );
      });

      query.containedIn('url', entries);
      query.find()
        .done(function (results) {
          var COUNT_CONTAINER_REF = '.leancloud-visitors-count';

          if (results.length === 0) {
            $visitors.find(COUNT_CONTAINER_REF).text(0);
            return;
          }

          for (var i = 0; i < results.length; i++) {
            var item = results[i];
            var url = item.get('url');
            var time = item.get('time');
            var element = document.getElementById(url);

            $(element).find(COUNT_CONTAINER_REF).text(time);
          }
          for(var i = 0; i < entries.length; i++) {
            var url = entries[i];
            var element = document.getElementById(url);
            var countSpan = $(element).find(COUNT_CONTAINER_REF);
            if( countSpan.text() == '') {
              countSpan.text(0);
            }
          }
        })
        .fail(function (object, error) {
          console.log("Error: " + error.code + " " + error.message);
        });
    }

    function addCount(Counter) {
      var $visitors = $(".leancloud_visitors");
      var url = $visitors.attr('id').trim();
      var title = $visitors.attr('data-flag-title').trim();
      var query = new AV.Query(Counter);

      query.equalTo("url", url);
      query.find({
        success: function(results) {
          if (results.length > 0) {
            var counter = results[0];
            counter.fetchWhenSave(true);
            counter.increment("time");
            counter.save(null, {
              success: function(counter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(counter.get('time'));
              },
              error: function(counter, error) {
                console.log('Failed to save Visitor num, with error message: ' + error.message);
              }
            });
          } else {
            var newcounter = new Counter();
            /* Set ACL */
            var acl = new AV.ACL();
            acl.setPublicReadAccess(true);
            acl.setPublicWriteAccess(true);
            newcounter.setACL(acl);
            /* End Set ACL */
            newcounter.set("title", title);
            newcounter.set("url", url);
            newcounter.set("time", 1);
            newcounter.save(null, {
              success: function(newcounter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(newcounter.get('time'));
              },
              error: function(newcounter, error) {
                console.log('Failed to create');
              }
            });
          }
        },
        error: function(error) {
          console.log('Error:' + error.code + " " + error.message);
        }
      });
    }

    $(function() {
      var Counter = AV.Object.extend("Counter");
      if ($('.leancloud_visitors').length == 1) {
        addCount(Counter);
      } else if ($('.post-title-link').length > 1) {
        showTime(Counter);
      }
    });
  </script>



  

  

  
  

  

  
  <script type="text/javascript" src="/js/src/js.cookie.js?v=5.1.4"></script>
  <script type="text/javascript" src="/js/src/scroll-cookie.js?v=5.1.4"></script>


  

</body>
</html>

<!-- 页面点击小红心 -->
<script type="text/javascript" src="/js/src/clicklove.js"></script>

